import { memo, useEffect } from "react";
import { EntireWrapper } from "./style";
import EntireFilter from "./comp/filter";
import { useDispatch } from "react-redux";
import { fetchRoomListAction } from "@/store/modules/entire/actions";
import EntireRooms from "./comp/rooms";
import EntirePagination from "./comp/pagination";
import { setHeaderConfigAction } from "@/store/modules/main";

const Entire = memo(() => {
  const dispatch = useDispatch();

  useEffect(() => {
    dispatch(fetchRoomListAction());
    dispatch(setHeaderConfigAction({ isFixed: true, topAlpha: false }));
  }, [dispatch]);

  return (
    <EntireWrapper>
      <EntireFilter />
      <EntireRooms />
      <EntirePagination />
    </EntireWrapper>
  );
});

export default Entire;
